- this_year = Time.now.year

.back
  %a{:href => '/'} &laquo; Home
  .clear
%h2
  Project:
  %b= @project.name.humanize
  %span.tip (#{@project.work_time.to_i / 1.hours} hours)

%p.tip #{@project.pinches.size} pinches, #{time_ago_in_words Time.now - (@project.work_time / @project.days.size / 1.hour).hours} per day in #{@project.days.size} days of work

%table.days
  - current = 0
  - @project.days.to_a.sort_by(&:first).reverse.each do |day, pinches|
    - time = pinches.sum(&:duration)
    - if time >= 1.minute
      %tr.day
        %td
          %a.day{:href => "/project/#{@project.name}/#{current}"} #{( this_year != day.year ? day.strftime("%Y %b %d, %a") : day.strftime("%b %d, %a") )}
        %td
          %span.work{:style => "background-color:green;color:#ccc;overflow:visible;height:1em"}= '&nbsp;' * (time / 5.minutes.to_f)
          %b= time_ago_in_words Time.now - time
        %td
          %span.tip= "#{'%.2f' % (time / 1.hour.to_f)} hours"
    - current = current + 1
